package test.huiwenshu;

public class Solution {
    public boolean isPalindrome(int x) {

        //1234
        if (x < 0 || (x % 10 == 0 && x != 0)) {

            return false;
        }
        int halfReverse = 0;
        while (x > halfReverse) {
            halfReverse = halfReverse * 10 + x % 10;
            x /= 10;
        }
        return x == halfReverse || x == halfReverse / 10;
    }
}
